#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int N=3e5+5,mod=998244353;
int n,k,q;
int p[N],c[N];
inline void add(int x,int k){while(x<=n)c[x]+=k,x+=x&-x;}
inline int ask(int x){
	int cur=0;
	while(x)cur+=c[x],x-=x&-x;
	return cur;
}
signed main(){
	freopen("random.in","r",stdin);
	freopen("random.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>k>>q;
	for(int i=1;i<=n;i++)cin>>p[i];
	int ans=0;
	for(int i=n;i>=1;i--)ans=(ans+ask(p[i]))%mod,add(p[i],1);
	cout<<ans<<endl;
	return 0;
}